package service

import (
	"context"
	"insighttracking/query/dao"
	"insighttracking/query/model"
)

type _storeSortingWeighRecordService struct {
}

func (s _storeSortingWeighRecordService) CreateStoreSortingWeighRecordApi(ctx context.Context, tx *dao.QueryTx, m *model.StoreSortingWeighRecordEntity) error {
	if err := tx.StoreSortingWeighRecordEntity.WithContext(ctx).Create(m); err != nil {
		return err
	}
	return nil
}

func (s _storeSortingWeighRecordService) GetStoreSortingWeighRecordApi(ctx context.Context, ordersId int64, ordersDetailId int64) ([]*model.StoreSortingWeighRecordEntity, error) {
	return dao.StoreSortingWeighRecordEntity.WithContext(ctx).Where(
		dao.StoreSortingWeighRecordEntity.OrdersID.Eq(ordersId),
		dao.StoreSortingWeighRecordEntity.OrdersDetailID.Eq(ordersDetailId),
	).Find()
}

var StoreSortingWeighRecordService = new(_storeSortingWeighRecordService)
